<?php

// +----------------------------------------------------------------------
// | 菜单路由数据表
// +----------------------------------------------------------------------

namespace common\model;

use think\model\RelationModel;

class MenuRouteModel extends RelationModel
{

    //自动验证
    protected $_validate = [
        ['name', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['name', '1,128', '', self::EXISTS_VALIDATE, 'length'],
//        ['name', '', '', self::EXISTS_VALIDATE, 'unique'],
        ['code', '1,128', '', self::EXISTS_VALIDATE, 'length'],
        ['code', '', '', self::EXISTS_VALIDATE, 'unique'],
        ['code', '', '', self::EXISTS_VALIDATE, 'alphaDash'],
        ['menu_module_id', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['route', '', '', self::MUST_VALIDATE, 'require', self::MODEL_INSERT],//必须字段
        ['route', '1,255', '', self::EXISTS_VALIDATE, 'length'],
        ['icon', '0,24', '', self::EXISTS_VALIDATE, 'length'],
    ];

    // 自动完成
    protected $_auto = [
//        ['code', 'auto_fill_code', self::MODEL_INSERT, 'function_with_data'],
        ['uuid', 'create_uuid', self::MODEL_INSERT, 'function']
    ];
}
